package com.cosina.game.crystallight.model.battle;

import android.graphics.Bitmap;
import android.graphics.Point;

import com.cosina.game.crystallight.engine.util.Time;

public class FrameObject implements Time{
	public final Point center;
	private int frameIndex = 0;
	private final Bitmap[] frames;
	
	public final float xspan, yspan;
	public FrameObject(int x, int y, Bitmap[] frames){
		this.center = new Point(x,y);
		this.frames = frames;
		this.xspan = frames[0].getWidth()/2.0f;
		this.yspan = frames[0].getHeight()/2.0f;
	}
	
	public Bitmap getFrame(){
		return frames[frameIndex];
	}
	
	public boolean isOver(){
		return frameIndex >= frames.length;
	}

	@Override
	public void withTimeGo() {
		frameIndex++;
	}
}
